package com.example.yaja.yaja.controller;

import com.example.yaja.yaja.entity.Hotel;
import com.example.yaja.yaja.service.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Zero on 2017/12/5.
 */
@RestController
@RequestMapping("/hotel")
public class HotelController {


    @Autowired
    HotelService hotelService;


    /**
     * 查找酒店信息
     * @return
     */
    @RequestMapping(value = "/findHotel",method = RequestMethod.GET)
    public Map<String,Object> findHotel(){

        Map<String,Object> map = new HashMap<String, Object>();
        List<Hotel> hotels=hotelService.findHotelByState(1, 5);
        if(hotels!=null){
            map.put("hotels",hotels);
        }else {
            map.put("hotelsState",0);
        }
        return map;
    }

}
